<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/webpage/include/taglib.jsp"%>
<html>
<head>
	<title>出库单管理</title>
	<meta name="decorator" content="ani"/>
	<script type="text/javascript">
		var validateForm;
		var $table; // 父页面table表格id
		var $topIndex;//弹出窗口的 index
		function doSubmit(table, index){//回调函数，在编辑和保存动作时，供openDialog调用提交表单。
		  if(validateForm.form()){
			  $table = table;
			  $topIndex = index;
			  jp.loading();
			  $("#inputForm").submit();
			  return true;
		  }

		  return false;
		}

		$(document).ready(function() {
			validateForm = $("#inputForm").validate({
				submitHandler: function(form){
					jp.post("${ctx}/wms/outbound/save2",$('#inputForm').serialize(),function(data){
						if(data.success){
	                    	$table.bootstrapTable('refresh');
	                    	jp.success(data.msg);
	                    	jp.close($topIndex);//关闭dialog

	                    }else{
            	  			jp.error(data.msg);
	                    }
					})
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
            $('#date').datetimepicker({
                format: "YYYY-MM-DD HH:00"
            });
            $('#deliveryTime').datetimepicker({
                format: "YYYY-MM-DD HH:00"
            });
            $('#actualDeliveryTime').datetimepicker({
                format: "YYYY-MM-DD HH:00"
            });
            $('#arrivalTime').datetimepicker({
                format: "YYYY-MM-DD HH:00"
            });
		});
		
		function addRow(list, idx, tpl, row){
			$(list).append(Mustache.render(tpl, {
				idx: idx, delBtn: true, row: row
			}));
			$(list+idx).find("select").each(function(){
				$(this).val($(this).attr("data-value"));
			});
			$(list+idx).find("input[type='checkbox'], input[type='radio']").each(function(){
				var ss = $(this).attr("data-value").split(',');
				for (var i=0; i<ss.length; i++){
					if($(this).val() == ss[i]){
						$(this).attr("checked","checked");
					}
				}
			});
			$(list+idx).find(".form_datetime").each(function(){
				 $(this).datetimepicker({
					 format: "YYYY-MM-DD HH:00"
			    });
			});
		}
		function delRow(obj, prefix){
			var id = $(prefix+"_id");
			var delFlag = $(prefix+"_delFlag");
			if (id.val() == ""){
				$(obj).parent().parent().remove();
			}else if(delFlag.val() == "0"){
				delFlag.val("1");
				$(obj).html("&divide;").attr("title", "撤销删除");
				$(obj).parent().parent().addClass("error");
			}else if(delFlag.val() == "1"){
				delFlag.val("0");
				$(obj).html("&times;").attr("title", "删除");
				$(obj).parent().parent().removeClass("error");
			}
		}
        function FormatDate (strTime) {
            var date = new Date(strTime);
            return date.getFullYear()+"-"+(date.getMonth()+1)+"-"+date.getDate();
        }
        function se2(a,b) {
            var c=$(document.getElementsByName("cksl")[a]).val();
            var num=parseInt("0");
            $("[type='checkbox' ]").each(function () {
                if($(this).is(":checked")){
                    var name=this.name;
                    if(a!=name){
                        var cksl=$(document.getElementsByName("cksl")[name]).val();
                        num=num+parseInt(cksl);
                    }

                }
            })
            var jh=$("#jhsl").text();
            var jhsl=parseInt(jh);
            var cs=jhsl-num;//剩余出库数量
            if(parseInt(c)>parseInt(b)||parseInt(c)>cs){
                jp.error("捡货量不能大于库存数量或者应出数量！");


                var sm=parseInt(b);//该行实际库存
                if(sm>=cs){
                    $(document.getElementsByName("cksl")[a]).val(cs);
                    var sj=$("#cksl").text(num+cs);
                }else{
                    $(document.getElementsByName("cksl")[a]).val(sm);
                    var sj=$("#cksl").text(num+sm);
                }

        }else{
                if(c==""){
                   c="0"
				}
                var sj=$("#cksl").text(num+parseInt(c));


			}
		}
		function  jh(id,f,a,b,c,e,idx) {
		            $("#id0").val(id);
		            $("#ww").text(f);
					$("#wl").text(a);
					$("#bm").text(b);
					$("#jhsl").text(c);
					$("#cksl").text($("#"+idx).text());
					$("#index").val(idx);

					$("#detil").empty();

            $.ajax({
					url:'${ctx}/wms/outbound/wlList?ii='+e,
				    success:function (data) {
                    $.each($.parseJSON(data), function (index,term) {

                        var addTr = $("<tr id='" + term.id + "'></tr>");
                        addTr.appendTo("#detil");
                        addTr.append("<td><input type='checkbox'  id='"+term.id+"'   name='"+index+"'  onchange='js(this)'/></td>");
                        addTr.append($('<td></td>').text(term.name.name));
                        addTr.append($('<td></td>').text(term.location.name));
                        addTr.append($("<td name='"+term.id+"'></td>").text(term.usable));
                        addTr.append($('<td></td>').text(term.batch));
                        addTr.append("<td ><input type='text' name='cksl' id='"+term.id+index+"' readonly='readonly' onkeyup='se2("+index+","+term.usable+")' class='sj'/></td>");
                    })
                        $("[type='checkbox' ]").each(function () {
                            var id=this.id;
                            var i=this.name;
                            var jh=$("#jhsl").text();
                            var sj=$("#cksl").text();

                            if(sj==""){sj="0";}
                            var jhsl=parseInt(jh);
                            var sjsl=parseInt(sj);
                            var cs=jhsl-sjsl;//剩余出库数量
							if(cs>0){
                            var sl=$(document.getElementsByName(id)[0]).text();
                            var sm=parseInt(sl);//该行实际库存
                            $(this).attr("checked", true);
                                $("#"+id+i).attr("readonly",false);
                            if(sm>=cs){
                                $(document.getElementsByName("cksl")[i]).val(cs);
                                $("#cksl").text(cs+sjsl);

                            }else{
                                $(document.getElementsByName("cksl")[i]).val(sm);
                                $("#cksl").text(sm+sjsl);
                            }
                            }	})
                },
				error:function () {
					jp.error("出错了")
                }
            })
			$("#model").modal("show");
        }
        function js(t) {
            var id=t.id;
            var i=t.name;
            var jh=$("#jhsl").text();
            var sj=$("#cksl").text();
            if(sj==""){sj="0";}
            var jhsl=parseInt(jh);
            var sjsl=parseInt(sj);
		    if(t.checked){
		        $("#"+id+i).attr("readonly",false);
                if(jhsl==sjsl){
                   jp.warning("该商品已完成出库");
                    t.checked=false;
                    return;
                }
                var cs=jhsl-sjsl;//剩余出库数量
                var sl=$(document.getElementsByName(id)[0]).text();
                var sm=parseInt(sl);//该行实际库存
                if(sm>=cs){
                    $(document.getElementsByName("cksl")[i]).val(cs);
                    $("#cksl").text(cs+sjsl);
                }else{
                    $(document.getElementsByName("cksl")[i]).val(sm);
                    $("#cksl").text(sm+sjsl);
                }
			}else{
                $("#"+id+i).attr("readonly",true);
               var v= $(document.getElementsByName("cksl")[i]).val();
                   $(document.getElementsByName("cksl")[i]).val(0);
                   v=parseInt(v);
                $("#cksl").text(sjsl-v);
			}

        }
        function cle() {
            $("[type='checkbox' ]").each(function () {
                $(this).attr("checked", false);
            })
            $("[class='sj' ]").each(function () {
                $(this).text("");
            })
        }
        function cl(){
            var idx=$("#index").val();
            var number=$("#ww").text();
            var ck=parseInt($("#cksl").text());
            $("#"+idx).text($("#cksl").text());
            var jh=parseInt($("#jhsl").text());
            var c=document.getElementsByName(idx);
            if(jh==ck){
                $(c).text("拣货完成");
                var id=$("#id0").val();
                $("#"+id).attr("disabled",true);
			}else if(ck>0){
                $(c).text("部分拣货");
			}

            $("[type='checkbox' ]").each(function () {
                if($(this).is(":checked")){
                    var id=this.id;
                    var name=this.name;
                    var cksl=$(document.getElementsByName("cksl")[name]).val();
                    $.ajax({
                        dataType:'json',
                        async:false,
                        url:'${ctx}/wms/inventory/editinventory?id='+id+"&sl="+cksl+"&i="+$("#id").val()+"&&number="+number,
                        success:function (data) {
                        }})

                }
            })
            var i=$("#id0").val();
            var sj=$("#cksl").text();
            $.ajax({
                dataType:'json',
                async:false,
                url:'${ctx}/wms/outbound/updatedetil?d='+i+"&sl="+sj,
                success:function (data) {
                }})
            $("[class='sj' ]").each(function () {
                $(this).text("");
            })
            $("#model").modal('hide');
        }
        function tt() {
		    $("#diy").empty();
          $.ajax({
			  url:"${ctx}/wms/pickDetailed/findList?pid="+$("#id").val(),
			  success:function (data) {
                  $.each($.parseJSON(data), function (index,term) {
                      var addTr = $("<tr></tr>");
                      addTr.appendTo("#diy");
                      addTr.append($('<td></td>').text(term.shippingOrder));
                      addTr.append($('<td></td>').text(term.number));
                      addTr.append($('<td></td>').text(term.name));
                      addTr.append($('<td></td>').text(term.code));
                      addTr.append($("<td></td>").text(term.location));
                      addTr.append($("<td></td>").text(term.bach));
                      addTr.append($('<td></td>').text(term.amount));


				  })
              }
		  })

        }
	</script>
</head>
<body class="bg-white">
		<form:form id="inputForm" modelAttribute="outbound" action="${ctx}/wms/outbound/save2" method="post" class="form-horizontal">
		<form:hidden path="id"/>
		<sys:message content="${message}"/>
			<ul class="nav nav-tabs">
				<li><a data-toggle="tab" href="#tab-01" aria-expanded="true">订单详情</a>
				</li>
				<li class=""><a data-toggle="tab" href="#tab-02" aria-expanded="true">服务信息</a>
				</li>
				<li class="active"><a data-toggle="tab" href="#tab-03" aria-expanded="true">选择明细</a>
				</li>
				<li class=""><a data-toggle="tab" href="#tab-04" aria-expanded="true" onclick="tt()">拣货明细</a>
				</li>
			</ul>
		<div class="tab-content">
			<div id="tab-01" class="tab-pane fade ">
				<table class="table table-bordered">
					<tbody>
					<tr>

						<td class="width-15 active"><label class="pull-right"><font color="red">*</font>出库单号：</label></td>
						<td class="width-35">
							<form:input path="code" htmlEscape="false"    class="form-control required"/>
						</td>
						<td class="width-15 active"><label class="pull-right">状态：</label></td>
						<td class="width-35">
							<form:input path="status" htmlEscape="false"    class="form-control "/>
						</td>
					</tr>
					<tr>
						<td class="width-15 active"><label class="pull-right">出库单类型：</label></td>
						<td class="width-35">
							<form:input path="type" htmlEscape="false"    class="form-control "/>
						</td>
						<td class="width-15 active"><label class="pull-right">订单日期：</label></td>
						<td class="width-35">
							<p class="input-group">
							<div class='input-group form_datetime' id='date'>
								<input type='text'  name="date" class="form-control"  value="<fmt:formatDate value="${outbound.date}" pattern="yyyy-MM-dd HH:00"/>"/>
								<span class="input-group-addon">
			                        <span class="glyphicon glyphicon-calendar"></span>
			                    </span>
							</div>
							</p>
						</td>
					</tr>
					<tr>
						<td class="width-15 active"><label class="pull-right">货主代码：</label></td>
						<td class="width-35">
							<form:input path="ownerCode" htmlEscape="false"    class="form-control "/>
						</td>
						<td class="width-15 active"><label class="pull-right">销售订单号：</label></td>
						<td class="width-35">
							<form:input path="entrustNumber" htmlEscape="false"    class="form-control "/>
						</td>
					</tr>
					<tr>
						<td class="width-15 active"><label class="pull-right">要求发货日期：</label></td>
						<td class="width-35">
							<p class="input-group">
							<div class='input-group form_datetime' id='deliveryTime'>
								<input type='text'  name="deliveryTime" class="form-control"  value="<fmt:formatDate value="${outbound.deliveryTime}" pattern="yyyy-MM-dd HH:00"/>"/>
								<span class="input-group-addon">
			                        <span class="glyphicon glyphicon-calendar"></span>
			                    </span>
							</div>
							</p>
						</td>
						<td class="width-15 active"><label class="pull-right">总订购量：</label></td>
						<td class="width-35">
							<form:input path="amount" htmlEscape="false"    class="form-control "/>
						</td>
					</tr>
					<tr>
						<td class="width-15 active"><label class="pull-right">外部订单号：</label></td>
						<td class="width-35">
							<form:input path="externalOrder" htmlEscape="false"    class="form-control "/>
						</td>
						<td class="width-15 active"><label class="pull-right">实际发货日期：</label></td>
						<td class="width-35">
							<p class="input-group">
							<div class='input-group form_datetime' id='actualDeliveryTime'>
								<input type='text'  name="actualDeliveryTime" class="form-control"  value="<fmt:formatDate value="${outbound.actualDeliveryTime}" pattern="yyyy-MM-dd HH:00"/>"/>
								<span class="input-group-addon">
			                        <span class="glyphicon glyphicon-calendar"></span>
			                    </span>
							</div>
							</p>
						</td>
					</tr>
					<tr>
						<td class="width-15 active"><label class="pull-right">总毛重：</label></td>
						<td class="width-35">
							<form:input path="grossWeight" htmlEscape="false"    class="form-control "/>
						</td>
						<td class="width-15 active"><label class="pull-right">总体积：</label></td>
						<td class="width-35">
							<form:input path="volume" htmlEscape="false"    class="form-control "/>
						</td>
					</tr>
					<tr>
						<td class="width-15 active"><label class="pull-right">项目名称：</label></td>
						<td class="width-35">
							<form:input path="projectName" htmlEscape="false"    class="form-control "/>
						</td>
						<td class="width-15 active"><label class="pull-right">到货日期：</label></td>
						<td class="width-35">
							<p class="input-group">
							<div class='input-group form_datetime' id='arrivalTime'>
								<input type='text'  name="arrivalTime" class="form-control"  value="<fmt:formatDate value="${outbound.arrivalTime}" pattern="yyyy-MM-dd HH:00"/>"/>
								<span class="input-group-addon">
			                        <span class="glyphicon glyphicon-calendar"></span>
			                    </span>
							</div>
							</p>
						</td>
					</tr>
					<tr>
						<td class="width-15 active"><label class="pull-right">总净重：</label></td>
						<td class="width-35">
							<form:input path="netWeight" htmlEscape="false"    class="form-control "/>
						</td>
						<td class="width-15 active"><label class="pull-right">总金额：</label></td>
						<td class="width-35">
							<form:input path="money" htmlEscape="false"    class="form-control "/>
						</td>
					</tr>
					<tr>
						<td class="width-15 active"><label class="pull-right">erp发运号：</label></td>
						<td class="width-35">
							<form:input path="shipmentNumbers" htmlEscape="false"    class="form-control "/>
						</td>
						<td class="width-15 active"><label class="pull-right">作业单号：</label></td>
						<td class="width-35">
							<form:input path="workNumber" htmlEscape="false"    class="form-control "/>
						</td>
					</tr>
					<tr>
						<td class="width-15 active"><label class="pull-right">箱数：</label></td>
						<td class="width-35">
							<form:input path="no" htmlEscape="false"    class="form-control "/>
						</td>
						<td class="width-15 active"><label class="pull-right">装卸类型：</label></td>
						<td class="width-35">
							<form:input path="loadingType" htmlEscape="false"    class="form-control "/>
						</td>
					</tr>
					<tr>
						<td class="width-15 active"><label class="pull-right">移动类型：</label></td>
						<td class="width-35">
							<form:input path="moveType" htmlEscape="false"    class="form-control "/>
						</td>
						<td class="width-15 active"><label class="pull-right">备注信息：</label></td>
						<td class="width-35">
							<form:input path="remarks" htmlEscape="false"    class="form-control "/>
						</td>
					</tr></tbody></table>

			</div>
			<div id="tab-02" class="tab-pane fade ">
				<table class="table table-bordered">
					<tbody>
					<tr>
						<td class="width-15 active"><label class="pull-right">物流商名称：</label></td>
						<td class="width-35">
							<form:input path="logisticsName" htmlEscape="false"    class="form-control "/>
						</td>
						<td class="width-15 active"><label class="pull-right">联系人：</label></td>
						<td class="width-35">
							<form:input path="logisticsPerson" htmlEscape="false"    class="form-control "/>
						</td>
					</tr>
					<tr>

						<td class="width-15 active"><label class="pull-right">联系人电话：</label></td>
						<td class="width-35">
							<form:input path="logisticsPhone" htmlEscape="false"    class="form-control "/>
						</td><td class="width-15 active"><label class="pull-right">车牌号码：</label></td>
						<td class="width-35">
							<form:input path="plateNumber" htmlEscape="false"    class="form-control "/>
						</td>

					</tr>
					<tr>

						<td class="width-15 active"><label class="pull-right">司机电话：</label></td>
						<td class="width-35">
							<form:input path="driverPhone" htmlEscape="false"    class="form-control "/>
						</td>
						<td class="width-15 active"><label class="pull-right">运输方式：</label></td>
						<td class="width-35">
							<form:input path="transportMode" htmlEscape="false"    class="form-control "/>
						</td>
					</tr>

					<tr>
						<td class="width-15 active"><label class="pull-right">司机姓名：</label></td>
						<td class="width-35">
							<form:input path="driverName" htmlEscape="false"    class="form-control "/>
						</td>
						<td class="width-15 active"><label class="pull-right">货主名称：</label></td>
						<td class="width-35">
							<form:input path="ownerName" htmlEscape="false"    class="form-control "/>
						</td>

					</tr>
					<tr>
						<td class="width-15 active"><label class="pull-right">地址：</label></td>
						<td class="width-35">
							<form:input path="ownerAddress" htmlEscape="false"    class="form-control "/>
						</td>
						<td class="width-15 active"><label class="pull-right">联系人：</label></td>
						<td class="width-35">
							<form:input path="ownerPerson" htmlEscape="false"    class="form-control "/>
						</td>

					</tr>
					<tr>
						<td class="width-15 active"><label class="pull-right">电话：</label></td>
						<td class="width-35">
							<form:input path="ownerPhone" htmlEscape="false"    class="form-control "/>
						</td>
						<%--<td class="width-15 active"><label class="pull-right">物流订单号：</label></td>--%>
						<%--<td class="width-35">--%>
							<%--<form:input path="logisticsOrder" htmlEscape="false"    class="form-control "/>--%>
						<%--</td>--%>
						<td class="width-15 active"><label class="pull-right">货主系统名称：</label></td>
						<td class="width-35">
							<form:input path="ownerSystem" htmlEscape="false"    class="form-control "/>
						</td>
					</tr>
					<tr>
						<td class="width-15 active"><label class="pull-right">收货单位名称：</label></td>
						<td class="width-35">
							<form:input path="unitName" htmlEscape="false"    class="form-control "/>
						</td>
						<td class="width-15 active"><label class="pull-right">收货单位确认人：</label></td>
						<td class="width-35">
							<form:input path="unitConfirmor" htmlEscape="false"    class="form-control "/>
						</td>
					</tr>
					<tr>
						<td class="width-15 active"><label class="pull-right">确认人电话：</label></td>
						<td class="width-35">
							<form:input path="phone" htmlEscape="false"    class="form-control "/>
						</td>
						<td class="width-15 active"><label class="pull-right">收货详细地址：</label></td>
						<td class="width-35">
							<form:input path="site" htmlEscape="false"    class="form-control "/>
						</td>
					</tr>
					<tr>
						<td class="width-15 active"><label class="pull-right">到站省：</label></td>
						<td class="width-35">
							<form:input path="arriveProvince" htmlEscape="false"    class="form-control "/>
						</td>
						<td class="width-15 active"><label class="pull-right">到站市：</label></td>
						<td class="width-35">
							<form:input path="arriveCity" htmlEscape="false"    class="form-control "/>
						</td>
					</tr>
					<tr>
						<td class="width-15 active"><label class="pull-right">合同里程：</label></td>
						<td class="width-35">
							<form:input path="distance" htmlEscape="false"    class="form-control "/>
						</td>
						<td class="width-15 active"><label class="pull-right">运输线路：</label></td>
						<td class="width-35">
							<form:input path="transitLines" htmlEscape="false"    class="form-control "/>
						</td>
					</tr>

					</tbody></table>
			</div>
			<div id="tab-03" class="tab-pane fade in  active">
				<div style="height:50px;"></div>
				<table class="table table-bordered">
					<tbody>
					<tr>
						<th>提货单号</th>
						<th>物料名称</th>
						<th>物料编码</th>
						<th>操作</th>
						<th>物料类型</th>
						<th>包装单位</th>
						<th>状态</th>
						<th>订货数量</th>
						<th>拣货数量</th>
					</tr>
					<input type="hidden" id="index" />
                    <c:forEach var="s" items="${outbound.storehouseList}" varStatus="status">
						<tr>
							<td>${s.number}</td>
							<td>${s.name.name}</td>
							<td>${s.code}</td>
							<td><input type="button" id="${s.id}" <c:if test="${s.status=='拣货完成'}">disabled="disabled"</c:if> class="btn-primary" value="拣货" onclick="jh('${s.id}','${s.number}','${s.name.name}','${s.code}','${s.orderNumber}','${s.name.id}','${status.index}')"></td>
							<td>${s.packing}</td>
							<td>${s.unit}</td>
							<td name="${status.index}">${s.status}</td>
							<td>${s.orderNumber}</td>
							<td id="${status.index}">${s.picking}</td>
						</tr>
					</c:forEach>
					</tbody>
				</table>
				<div style="height: 100px"></div>
				<div class="tabs-container" <c:if test="${outbound.status!='拣货完成'and outbound.status!='已发车'}">hidden="hidden" </c:if>>
					<table class="table table-striped table-bordered table-condensed">
						<tr>
							<th>捡货数量</th>
							<th>${outbound.amount}</th>
							<th>总毛重</th>
							<th>${outbound.grossWeight}</th>
							<th>吨罐</th>
							<th>${outbound.dg}</th>
							<th>吨箱</th>
							<th>${outbound.dx}</th>
							<th>小黄桶</th>
							<th>${outbound.xht}</th>
							<th>小箱</th>
							<th>${outbound.xx}</th>
							<th>小桶</th>
							<th>${outbound.xt}</th>
							<th>中桶</th>
							<th>${outbound.zt}</th>
							<th>大桶</th>
							<th>${outbound.dt}</th>
							<th>袋</th>
							<th>${outbound.dai}</th>
							<th>件</th>
							<th>${outbound.jian}</th>
						</tr>
					</table>
					<ul class="nav nav-tabs">
						<li class="active"><a data-toggle="tab" href="#tab-1" aria-expanded="true">出库工作量统计：</a>
						</li>
							<%--<li class="active"><a data-toggle="tab" href="#tab-2" aria-expanded="false">出库物料明细：</a>--%>
							<%--</li>--%>
					</ul>
					<div class="tab-content" >
						<div id="tab-1" class="tab-pane fade in  active">
							<a class="btn btn-white btn-sm" onclick="addRow('#outStatisticsList', outStatisticsRowIdx, outStatisticsTpl);outStatisticsRowIdx = outStatisticsRowIdx + 1;" title="新增"><i class="fa fa-plus"></i> 新增</a>
							<table class="table table-striped table-bordered table-condensed">
								<thead>
								<tr>
									<th class="hide"></th>
									<th width="15%">职位</th>
									<th width="15%">姓名</th>
									<th>吨罐</th>
									<th>吨箱</th>
									<th>小黄桶</th>
									<th>小箱</th>
									<th>小桶</th>
									<th>中桶</th>
									<th>大桶</th>
									<th>袋</th>
									<th>件</th>
									<th width="10%">备注信息</th>
									<th width="10">&nbsp;</th>
								</tr>
								</thead>
								<tbody id="outStatisticsList">
								</tbody>
							</table>
							<script type="text/template" id="outStatisticsTpl">//<!--
							<tr id="outStatisticsList{{idx}}">
							<td class="hide">
							<input id="outStatisticsList{{idx}}_id" name="outStatisticsList[{{idx}}].id" type="hidden" value="{{row.id}}"/>
							<input id="outStatisticsList{{idx}}_delFlag" name="outStatisticsList[{{idx}}].delFlag" type="hidden" value="0"/>
							</td>

							<td>
							<sys:gridselect url="${ctx}/infor/position/data" id="outStatisticsList{{idx}}_position" name="outStatisticsList[{{idx}}].position.id" value="{{row.position.id}}" labelName="outStatisticsList[{{idx}}].position.name" labelValue="{{row.position.name}}"
							title="选择职位" cssClass="form-control  " fieldLabels="名称" fieldKeys="name" searchLabels="名称" searchKeys="name" ></sys:gridselect>
							</td>


							<td>
							<sys:gridselect url="${ctx}/infor/staff/data" id="outStatisticsList{{idx}}_name" name="outStatisticsList[{{idx}}].name.id" value="{{row.name.id}}" labelName="outStatisticsList[{{idx}}].name.name" labelValue="{{row.name.name}}"
							title="选择员工" cssClass="form-control  " fieldLabels="名称" fieldKeys="name" searchLabels="名称" searchKeys="name" ></sys:gridselect>

							</td>

							<td>
							<input id="outStatisticsList{{idx}}_dg" name="outStatisticsList[{{idx}}].dg" type="text" value="{{row.dg}}"    class="form-control "/>
							</td>
							<td>
							<input id="outStatisticsList{{idx}}_dx" name="outStatisticsList[{{idx}}].dx" type="text" value="{{row.dx}}"    class="form-control "/>
							</td>
							<td>
							<input id="outStatisticsList{{idx}}_xht" name="outStatisticsList[{{idx}}].xht" type="text" value="{{row.xht}}"    class="form-control "/>
							</td>
							<td>
							<input id="outStatisticsList{{idx}}_xx" name="outStatisticsList[{{idx}}].xx" type="text" value="{{row.xx}}"    class="form-control "/>
							</td>
							<td>
							<input id="outStatisticsList{{idx}}_xt" name="outStatisticsList[{{idx}}].xt" type="text" value="{{row.xt}}"    class="form-control "/>
							</td>
							<td>
							<input id="outStatisticsList{{idx}}_zt" name="outStatisticsList[{{idx}}].zt" type="text" value="{{row.zt}}"    class="form-control "/>
							</td>
							<td>
							<input id="outStatisticsList{{idx}}_dt" name="outStatisticsList[{{idx}}].dt" type="text" value="{{row.dt}}"    class="form-control "/>
							</td>
<td>
							<input id="outStatisticsList{{idx}}_dai" name="outStatisticsList[{{idx}}].dai" type="text" value="{{row.dai}}"    class="form-control "/>
							</td>
							<td>
							<input id="outStatisticsList{{idx}}_jian" name="outStatisticsList[{{idx}}].jian" type="text" value="{{row.jian}}"    class="form-control "/>
							</td>

							<td>
							<input id="outStatisticsList{{idx}}_remarks" name="outStatisticsList[{{idx}}].remarks"     class="form-control ">{{row.remarks}}</textarea>
							</td>

							<td class="text-center" width="10">
							{{#delBtn}}<span class="close" onclick="delRow(this, '#outStatisticsList{{idx}}')" title="删除">&times;</span>{{/delBtn}}
							</td>
							</tr>//-->
							</script>
							<script type="text/javascript">
                                var outStatisticsRowIdx = 0, outStatisticsTpl = $("#outStatisticsTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
                                $(document).ready(function() {
                                    var data = ${fns:toJson(outbound.outStatisticsList)};
                                    for (var i=0; i<data.length; i++){
                                        addRow('#outStatisticsList', outStatisticsRowIdx, outStatisticsTpl, data[i]);
                                        outStatisticsRowIdx = outStatisticsRowIdx + 1;
                                    }
                                });
							</script>
						</div>
							<%--<div id="tab-2" class="tab-pane fade in active">--%>
							<%--<a class="btn btn-white btn-sm" onclick="addRow('#storehouseList', storehouseRowIdx, storehouseTpl);storehouseRowIdx = storehouseRowIdx + 1;" title="新增"><i class="fa fa-plus"></i> 新增</a>--%>
							<%--<table class="table table-striped table-bordered table-condensed">--%>
							<%--<thead>--%>
							<%--<tr>--%>
							<%--<th class="hide"></th>--%>
							<%--<th><font color="red">*</font>物料名称</th>--%>
							<%--<th>物料编码</th>--%>
							<%--<th>包装</th>--%>
							<%--<th>单位</th>--%>
							<%--<th>箱号</th>--%>
							<%--<th>状态</th>--%>
							<%--<th>订货数量</th>--%>
							<%--<th>分配数量</th>--%>
							<%--<th>拣货数量</th>--%>
							<%--<th>发货数量</th>--%>
							<%--<th>单价</th>--%>
							<%--<th>金额</th>--%>
							<%--<th width="10">&nbsp;</th>--%>
							<%--</tr>--%>
							<%--</thead>--%>
							<%--<tbody id="storehouseList">--%>
							<%--</tbody>--%>
							<%--</table>--%>
							<%--<script type="text/template" id="storehouseTpl">//<!----%>
							<%--<tr id="storehouseList{{idx}}">--%>
							<%--<td class="hide">--%>
							<%--<input id="storehouseList{{idx}}_id" name="storehouseList[{{idx}}].id" type="hidden" value="{{row.id}}"/>--%>
							<%--<input id="storehouseList{{idx}}_delFlag" name="storehouseList[{{idx}}].delFlag" type="hidden" value="0"/>--%>
							<%--</td>--%>

							<%--<td>--%>
							<%--<input id="storehouseList{{idx}}_name" name="storehouseList[{{idx}}].name" type="text" value="{{row.name}}"    class="form-control required"/>--%>
							<%--</td>--%>


							<%--<td>--%>
							<%--<input id="storehouseList{{idx}}_code" name="storehouseList[{{idx}}].code" type="text" value="{{row.code}}"    class="form-control "/>--%>
							<%--</td>--%>


							<%--<td>--%>
							<%--<input id="storehouseList{{idx}}_packing" name="storehouseList[{{idx}}].packing" type="text" value="{{row.packing}}"    class="form-control "/>--%>
							<%--</td>--%>


							<%--<td>--%>
							<%--<input id="storehouseList{{idx}}_unit" name="storehouseList[{{idx}}].unit" type="text" value="{{row.unit}}"    class="form-control "/>--%>
							<%--</td>--%>


							<%--<td>--%>
							<%--<input id="storehouseList{{idx}}_no" name="storehouseList[{{idx}}].no" type="text" value="{{row.no}}"    class="form-control "/>--%>
							<%--</td>--%>


							<%--<td>--%>
							<%--<input id="storehouseList{{idx}}_status" name="storehouseList[{{idx}}].status" type="text" value="{{row.status}}"    class="form-control "/>--%>
							<%--</td>--%>


							<%--<td>--%>
							<%--<input id="storehouseList{{idx}}_orderNumber" name="storehouseList[{{idx}}].orderNumber" type="text" value="{{row.orderNumber}}"    class="form-control "/>--%>
							<%--</td>--%>


							<%--<td>--%>
							<%--<input id="storehouseList{{idx}}_distribution" name="storehouseList[{{idx}}].distribution" type="text" value="{{row.distribution}}"    class="form-control "/>--%>
							<%--</td>--%>


							<%--<td>--%>
							<%--<input id="storehouseList{{idx}}_picking" name="storehouseList[{{idx}}].picking" type="text" value="{{row.picking}}"    class="form-control "/>--%>
							<%--</td>--%>


							<%--<td>--%>
							<%--<input id="storehouseList{{idx}}_deliver" name="storehouseList[{{idx}}].deliver" type="text" value="{{row.deliver}}"    class="form-control "/>--%>
							<%--</td>--%>


							<%--<td>--%>
							<%--<input id="storehouseList{{idx}}_price" name="storehouseList[{{idx}}].price" type="text" value="{{row.price}}"    class="form-control "/>--%>
							<%--</td>--%>


							<%--<td>--%>
							<%--<input id="storehouseList{{idx}}_money" name="storehouseList[{{idx}}].money" type="text" value="{{row.money}}"    class="form-control "/>--%>
							<%--</td>--%>

							<%--<td class="text-center" width="10">--%>
							<%--{{#delBtn}}<span class="close" onclick="delRow(this, '#storehouseList{{idx}}')" title="删除">&times;</span>{{/delBtn}}--%>
							<%--</td>--%>
							<%--</tr>//-->--%>
							<%--</script>--%>
							<%--<script type="text/javascript">--%>
							<%--var storehouseRowIdx = 0, storehouseTpl = $("#storehouseTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");--%>
							<%--$(document).ready(function() {--%>
							<%--var data = ${fns:toJson(outbound.storehouseList)};--%>
							<%--for (var i=0; i<data.length; i++){--%>
							<%--addRow('#storehouseList', storehouseRowIdx, storehouseTpl, data[i]);--%>
							<%--storehouseRowIdx = storehouseRowIdx + 1;--%>
							<%--}--%>
							<%--});--%>
							<%--</script>--%>
							<%--</div>--%>
					</div>
				</div>
			</div>
			<div id="tab-04" class="tab-pane fade ">
                <table class="table table-bordered">
                <tr>
					<th>装运单号</th>
					<th>提货单号</th>
					<th>物料名称</th>
					<th>物料编码</th>
					<th>来源货位</th>
					<th>批次</th>
					<th>拣货数量</th>
				</tr>
					<tbody id="diy"></tbody>
				</table>
			</div>
		</div>


		</form:form>
		<div class="modal" id="model" >
			<div class="modal-dialog" style="width: 1200px;">
				<div class="modal-content" >
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
						<h4 class="modal-title">拣货出库</h4>
					</div>
					<div class="modal-body" >
						<div ><button type="button" class="btn btn-danger" onclick="cl()" >确定</button>
							<button type="button" class="btn " onclick="cle()" >重置</button>
						</div>
						<div>
							<table class="table table-bordered">
								<input type="hidden" id="id0" value=""/>
								<tr>
									<td>提货单号</td>
									<td id="ww"></td>
									<td>物料名称</td>
									<td id="wl"></td>
									<td>物料编码</td>
									<td id="bm"></td>
									<td>订货数量</td>
									<td id="jhsl"></td>
									<td>拣货数量</td>
									<td class='sj'  id="cksl"></td>
								</tr>
							</table>
						</div>
						<table class="table table-bordered">
							<thead>
							<tr>
								<th></th>
								<th>物料名称</th>
								<th>货位</th>
								<th>库存</th>
								<th>批次</th>
								<th>已出库</th>
							</tr>
							</thead>
							<tbody id="detil">

							</tbody>
						</table>

					</div>
				</div>
			</div></div>
</body>
</html>